package firstPart.mythread.method;

/**
 * @Auther     : yxpweb
 * @Date       : 2021/7/4 11:48
 * @Description: 通过构造方法的方式来生命一个Thread，注意区别
 */
public class MyIsAlive {
    public static void main(String[] args) {
        CountOperate countOperate = new CountOperate();
        Thread t1 = new Thread(countOperate);
        System.out.println("main begin t1 is Alive = " + t1.isAlive());
        t1.setName("A");
        t1.start();
        System.out.println("main end t1 isAlive = " + t1.isAlive());
    }
}

//        CountOperate --- begin
//        1Thread.currentThread().getName = main
//        1this.getName() = Thread-0
//        CountOperate --- end
//        main begin t1 is Alive = false
//        main end t1 isAlive = true
//        run --- begin
//        2Thread.currentThread().getName = A
//        2this.getName() = Thread-0
//        run --- end

//class CountOperate extends Thread{
//    public CountOperate(){
//        System.out.println("CountOperate--begin");
//    }
//
//    @Override
//    public void run() {
//        System.out.println("run-begin");
//        System.out.println("Thread.currentThread().getName()=" + Thread.currentThread().getName());
//        System.out.println("Thread.currentThread().isAlive()=" + Thread.currentThread().isAlive());
//        System.out.println("this.getName()=" + this.getName());
//        System.out.println("this.isAlive()=" + this.isAlive());
//        System.out.println("run-end");
//    }
//}
